package com.scwatch.core.domain;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * Created by rh006 on 2017/7/26.
 */


@Entity
@Table(name = "cms_programdatecheck")
public class ProgramDatecheack implements java.io.Serializable{

    private static final long serialVersionUID = 1L;
    /**
     * 启用
     */
    public static final int NORMAL = 0;
    /**
     * 禁用
     */
    public static final int DISABLED = 1;



    private Integer id;
    private String name;
    /*private String replacement;*/
   /* private Integer status;*/
    private User user;
    private Date time;
//    private Integer pid;

    private Programback programback;

    private List<ProgramBackcode> programBackcodes;

    @Id
    @Column(name = "d_id", unique = true, nullable = false)
    @TableGenerator(name = "tg_cms_hot_word", pkColumnValue = "cms_hot_word", initialValue = 1, allocationSize = 10)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "tg_cms_hot_word")
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "d_date", nullable = false, length = 100)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "d_user_id", nullable = false)
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "d_crtime", nullable = false, length = 19)
    public Date getTime() {
        return this.time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

//    @Column(name = "p_back_id", nullable = false, length = 19)
//    public Integer getPid() {
//        return this.pid;
//    }
//
//    public void setPid(Integer pid) {
//        this.pid = pid;
//    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "p_back_id", referencedColumnName = "p_id", nullable = false)
    public Programback getProgramback() {
        return programback;
    }

    public void setProgramback(Programback programback) {
        this.programback = programback;
    }

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    public List<ProgramBackcode> getProgramBackcodes() {
        return programBackcodes;
    }

    public void setProgramBackcodes(List<ProgramBackcode> programBackcodes) {
        this.programBackcodes = programBackcodes;
    }
}
